package ch.sv7.tool.dbmanager.db.difference;

import ch.sv7.tool.dbmanager.db.ForeignKeySchema;
import ch.sv7.tool.dbmanager.db.TableSchema;

public class MissingForeignKeyDifference extends AbstractTableDifference {

	private ForeignKeySchema foreignKey;

	public MissingForeignKeyDifference(TableSchema expectedTableSchema, TableSchema actualTableSchema, ForeignKeySchema foreignKey) {
		super(expectedTableSchema, actualTableSchema);
		this.foreignKey = foreignKey;
	}

	/**
	 * @return the foreignKey
	 */
	public ForeignKeySchema getForeignKey() {
		return foreignKey;
	}

	public String getMessage() {
		return super.getMessage() 
			+ " foreign key on columns " + getForeignKey().getColumns() 
			+ " to table " + getForeignKey().getForeignTable() 
			+ " on columns " + getForeignKey().getForeignColumns()+ " - is missing";
	}

	public boolean isBlocker() {
		return true;
	}	
	
}
